home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Pascal Super Library
/
Pascal Super Library (CW International)(1997).bin
/
STRINGS
/
PACKAGE6
/
INSERT.DOC
< prev
next >
Wrap
Text File
|
1990-07-25
|
2KB
|
48 lines
------------------------------------------------------------------------------
InsertIntoString
------------------------------------------------------------------------------
declaration: procedure InsertIntoString ( StringPiece:
TypeString;
var ResultString:
TypeString;
StartPosition:
integer);
purpose: Returns ResultString with the StringPiece inserted
at the StartPosition and any contents to the right
(or greater than StartPosition) are shifted rightwards.
precondition: StringPiece, ResultString, and StartPosition are defined.
postcondition: ResultString is returned with the StringPiece inserted
into the PackedArray and the any contents to the right (or
greater than StartPosition) are shifted rightwards.
special cases: none
example: var
ResultString,
StringPiece:
TypeString;
StartPosition:
integer;
begin
.
.
.
write (output,'Enter a string: ');
ReadLnString (ResultString, LastKey);
write (output,'Enter string piece: ');
ReadLnString (StringPiece, LastKey)
write (output,'Enter position to be inserted at: ');
ReadLnCardinal (StartPosition, LastKey);
InsertIntoString (StringPiece, ResultString, StartPosition);
.
.
.
end
------------------------------------------------------------------------------